package com.usefullc.common.enums;


import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 最近天数
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum RecentDateEnum {

    DAY(0, "天","yyyy-MM-dd HH", 24,11),
    WEEK(1, "一周", "yyyy-MM-dd",7,6),
    MONTH(2, "一个月", "yyyy-MM-dd",30,6),
    HALF_YEAR(3, "半年", "yyyy-MM",6,2),
    YEAR(4, "一年", "yyyy-MM",12,2),


    ;


    private int code;
    private String value;
    private String format;
    private int num;
    private int field;

    RecentDateEnum(int code, String value,String format, int num,int field) {
        this.code = code;
        this.value = value;
        this.format = format;
        this.num = num;
        this.field = field;
    }


    public static RecentDateEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (RecentDateEnum s : RecentDateEnum.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {


        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public int getNum() {
        return num;
    }

    public String getFormat() {
        return format;
    }

    public int getField() {
        return field;
    }
}
